-
Notifications
You must be signed in to change notification settings - Fork 1
cmid&zmid #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmid&zmid #179
Conversation
python/colorscales.md
Outdated
z=[[1, 5, 3, 2], [5, 3, 7, 9], [3, 2, 6, 4]], | ||
zmid=10, | ||
colorbar={ | ||
"len": 0.5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you could use here a colormap for which the midpoint is white, like 'RdBu'
, so that the midpoint is more visible.
python/colorscales.md
Outdated
@@ -196,6 +196,41 @@ fig.add_trace(go.Heatmap( | |||
fig.show() | |||
``` | |||
|
|||
### Colorscale Midpoint | |||
The following example uses [cmid](https://plot.ly/python/reference/#scatter-marker-cmid) attribute to set the mid-point of the color domain by scaling [cmin](https://plot.ly/python/reference/#scatter-marker-cmin) and/or [cmax](https://plot.ly/python/reference/#scatter-marker-cmax) to be equidistant to this point. It only has impact when [marker.line.color](https://plot.ly/python/reference/#scattercarpet-marker-line-color) sets to a numerical array, and [marker.line.cauto](https://plot.ly/python/reference/#scattercarpet-marker-line-cauto) is `True`. The heatmap chart uses [zmid](https://plot.ly/python/reference/#heatmap-zmid) attribute to set the mid-point of the color domain by scaling [zmin](https://plot.ly/python/reference/#heatmap-zmin) and/or [zmax](https://plot.ly/python/reference/#heatmap-zmax) to be equidistant to this point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's marker.color
and not marker.line.color
?
python/colorscales.md
Outdated
@@ -196,6 +196,41 @@ fig.add_trace(go.Heatmap( | |||
fig.show() | |||
``` | |||
|
|||
### Colorscale Midpoint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting the midpoint of a diverging colorscale
python/colorscales.md
Outdated
fig = go.Figure() | ||
|
||
fig.add_trace(go.Scatter( | ||
y=[1, 2, 0, 1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the data should range from, say -5 to +15
python/colorscales.md
Outdated
"title": {"text": "cmid=0", "side": "right"} | ||
}})) | ||
|
||
fig.add_trace(go.Heatmap( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just use 1 trace here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe make a separate plot for the heatmap and say "heatmap uses zmid to do the same thing"
python/colorscales.md
Outdated
"size": 25, | ||
"color": [1,4,8], | ||
"cmid": 0, | ||
"colorbar": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove the colorbar settings
@Mahdis-z I resolved the conflict, please pull from the remote branch first before pushing new commits |
Awesome, will do |
python/colorscales.md
Outdated
fig.add_trace(go.Scatter( | ||
y=list(range(-5,15)), | ||
mode="markers", | ||
marker={"size": 25, "color": list(range(-10,10)), "cmid": 0})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use here asymmetric values to show the effect of cmid
(here zero is already the middle of the range). For example
marker={"size": 25, "color": list(range(-3,10)), "cmid": 0}
python/colorscales.md
Outdated
```python | ||
import plotly.graph_objects as go | ||
|
||
a = list(range(-15,5)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start at -10 here to have an asymmetric range
Thanks, 💃 ! |
Doc upgrade checklist:
unconverted/x/y.md
tox/y.md
plot()
oriplot()
graph_objs
has been renamed tograph_objects
fig = <something>
call is high up in each exampletrace
objectsadd_trace
andupdate_layout
fig.show()
at the end of each examplepx
example at the top if appropriate